/*
 * @Author: 李超越 1509572300@qq.com
 * @Date: 2024-07-30 11:53:31
 * @LastEditors: 李超越 1509572300@qq.com
 * @LastEditTime: 2024-07-30 13:08:51
 * @FilePath: /my_git/lesson25_pipe_fifo/PipeClient.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include "Comm.hpp"

int main()
{
    int wfd=open(Path,O_WRONLY);
    if(wfd<0)
    {
        cerr<<"open failed,errno:"<<errno<<",errstring:"<<strerror(errno)<<endl;
        return 1;
    }
    string inbuffer;
    while(true)
    {
        cout<<"Please Enter Your Message:";
        getline(cin,inbuffer);
        if(inbuffer=="quit")
        {
            break;
        }
        ssize_t n=write(wfd,inbuffer.c_str(),inbuffer.size());
        if(n<0)
        {
            cerr<<"write failed,errno:"<<errno<<",errstring:"<<strerror(errno)<<endl;
            break;
        }
    }
    close(wfd);
    return 0;
}